package test;


/**
 *完成从字母表中随机抽取n个不重复的字符问题.
 */
public class RandomChars {
	  public static void main(String[] arg){
		  char[] arr=randomChars(12);
		  for(int i=0;i<arr.length;i++){
			  System.out.println(arr[i]);
		  }
	  }
	  public static char[] randomChars(int num){
		  char[] result=new char[num];
		  int index=0;
		  outer:
		  while(index<num){
			  char c=(char)('a'+Math.random()*26);
			  for(int i=0;i<index;i++){
				  if(result[i]==c){
					  continue outer;
				  }
			  }
			  result[index]=c;
			  index++;
		  }
		  return result;
	  }
	}

